package com.come4loves.core.result;

import com.come4loves.core.comunicate.protocol.StatusCode;
/**
 * byte数组结果集
 * @author jerry
 *
 */
public class BytesResult {

	public short statusCode;
	
	public byte[] bytes;
	
	public static BytesResult sucess(byte[] result) {
		BytesResult res = new BytesResult();
		res.bytes = result;
		res.statusCode = StatusCode.SUCCESS;
		return res;
	}
	
	public static BytesResult sucess() {
		BytesResult res = new BytesResult();
		res.statusCode = StatusCode.SUCCESS;
		return res;
	}
	
	public static BytesResult valueOf(short statusCode) {
		BytesResult result = new BytesResult();
		result.statusCode = statusCode;
		return result;
	}
	
	public boolean isFail() {
		return statusCode != StatusCode.SUCCESS;
	}
	
	public boolean isOk() {
		return statusCode == StatusCode.SUCCESS;
	}
}
